home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / WINDOWS / WXLSLIB.ARJ / GRAPHICS.LSP < prev    next >
Lisp/Scheme  |  1992-02-20  |  22KB  |  560 lines

  1. ;;;;
  2. ;;;; graphics.lsp XLISP-STAT dynamic graphics functions and objects
  3. ;;;; XLISP-STAT 2.1 Copyright (c) 1990, by Luke Tierney
  4. ;;;; Additions to Xlisp 2.1, Copyright (c) 1989 by David Michael Betz
  5. ;;;; You may give out copies of this software; for conditions see the file
  6. ;;;; COPYING included with this distribution.
  7. ;;;;
  8.  
  9. (provide "graphics")
  10. (require "statistics" #+msdos "stats")
  11. (require "dialogs")
  12.  
  13. ;;;
  14. ;;; Miscelaneous Functions
  15. ;;;
  16.  
  17. (defun close-all-plots ()
  18. "Args: ()
  19. Close all plot windos."
  20.   (let ((plots (remove nil 
  21.                        (mapcar #'(lambda (x) 
  22.                                  (let ((object (nth 2 x)))
  23.                                    (if (kind-of-p object graph-window-proto) 
  24.                                        object
  25.                                        nil)))
  26.                                *hardware-objects*))))
  27.     (mapcar #'(lambda (x) (send x :remove)) plots)))
  28.  
  29. (defun get-new-integer (prompt low high initial)
  30. "Args: (prompt low high initial)
  31. Open dialog to get an integer in the range (LOW HIGH). Returns the integer
  32. or NIL if Cancelled or integer is not in range. Beeps if integer is bad."
  33.   (let ((val (get-value-dialog (format nil "~a: (between ~d and ~d)" 
  34.                                        prompt low high) :initial initial)))
  35.     (if val (cond 
  36.               ((and (integerp (car val)) (< low (car val) high)) (car val))
  37.               (t (sysbeep) nil)))))
  38.  
  39. (defun linked-plots ()
  40. "Args: ()
  41. Return list of all linked plots."
  42.   (let ((plots nil))
  43.     (dolist (x *hardware-objects*)
  44.             (let ((x (nth 2 x)))
  45.               (if (and (kind-of-p x graph-proto) (send x :linked)) 
  46.                   (push x plots))))
  47.     plots))
  48.  
  49. (defun active-graph-windows ()
  50. "Args: ()
  51. Return list of all currently visible graph windows."
  52.   (remove-if-not #'(lambda (x) (kind-of-p x graph-window-proto))
  53.          (mapcar #'third *hardware-objects*)))
  54.  
  55. (defun color-symbols ()
  56. "Args: ()
  57. Returns list of symbols with color definitions."
  58.   (let* ((n (length *obarray*))
  59.          (h (hash '*unbound* n))
  60.          (res nil))
  61.     (dotimes (i n res)
  62.              (let ((syms (aref *obarray* i)))
  63.                (dolist (s (if (= i h) (remove '*unbound* syms) syms))
  64.                        (if (get s '|color-index|) 
  65.                            (setf res (cons s res))))))))
  66.  
  67. (defun cursor-symbols ()
  68. "Args: ()
  69. Returns list of symbols with cursor definitions."
  70.   (let* ((n (length *obarray*))
  71.          (h (hash '*unbound* n))
  72.          (res nil))
  73.     (dotimes (i n res)
  74.              (let ((syms (aref *obarray* i)))
  75.                (dolist (s (if (= i h) (remove '*unbound* syms) syms))
  76.                        (if (get s '|cursor-index|) 
  77.                            (setf res (cons s res))))))))
  78.       
  79. (defun plot-symbol-symbols ()
  80. "Args: ()
  81. Returns list of symbols with plot symbol definitions."
  82.   (let* ((n (length *obarray*))
  83.          (h (hash '*unbound* n))
  84.          (res nil))
  85.     (dotimes (i n res)
  86.              (let ((syms (aref *obarray* i)))
  87.                (dolist (s (if (= i h) (remove '*unbound* syms) syms))
  88.                        (if (get s '|symbol-index|) 
  89.                            (setf res (cons s res))))))))
  90.  
  91. (defun pause (n)
  92. "Args: (n)
  93. Pause for N/60 seconds."
  94.   (flush-graphics)
  95.   (let ((ticks (+ (* (/ n 60) internal-time-units-per-second)
  96.                   (get-internal-run-time))))
  97.     (loop (if (<= ticks (get-internal-run-time)) (return)))))
  98.  
  99. ;;;
  100. ;;; Functions to link several plots
  101. ;;;
  102.  
  103. (defun link-views (&rest args)
  104. "Args: (&rest plots)
  105. Links the argument plots: any change in hiliting or visibility of points in
  106. the current plot is propagated to the other plots."
  107.   (mapc #'(lambda (x) (send x :linked t)) args))
  108.         
  109. (defun unlink-views (&rest args)
  110. "Args: (&rest plots)
  111. Removes links to its arguments. With no arguments removes all links."
  112.   (if args
  113.       (mapc #'(lambda (x) (send x :linked nil)) args)
  114.       (unlink-all-windows)))
  115.  
  116. ;;;;
  117. ;;;; GRAPH-PROTO Methods
  118. ;;;;
  119.  
  120. (defmeth graph-proto :current-variables (&optional x y &key (draw t))
  121. "Method args: (&optional x y &key (draw t))
  122. Sets or retrieves current variables."
  123.   (when x
  124.         (send self :content-variables x y)
  125.         (if draw (send self :redraw)))
  126.   (send self :content-variables))
  127.  
  128. (defmeth spin-proto :current-variables (&optional x y z &key (draw t))
  129. "Method args: (&optional x y z &key (draw t))
  130. Sets or retrieves current variables."
  131.   (when x
  132.         (send self :content-variables x y z)
  133.         (if draw (send self :redraw)))
  134.   (send self :content-variables))
  135.  
  136. (defmeth graph-proto :scale-type (&optional (new nil set) &key (draw t))
  137. "Method args: (&optional new)
  138. Sets or returns scale type."
  139.   (when set
  140. ;       (setf (slot-value 'scale-type) 
  141. ;              (case new ((fixed variable) new) (t nil)))
  142.         (setf (slot-value 'scale-type) new)
  143.         (send self :adjust-to-data :draw draw))
  144.   (slot-value 'scale-type))
  145.   
  146. (defmeth graph-proto :menu-title (&optional (title nil set))
  147.   (if set (setf (slot-value 'menu-title) title))
  148.   (slot-value 'menu-title))
  149.   
  150. (defmeth graph-proto :variable-labels (&optional (val nil set))
  151.   (if set (setf (slot-value 'variable-labels) (map 'vector #'string val)))
  152.   (slot-value 'variable-labels))
  153.   
  154. (defmeth graph-proto :black-on-white (&optional (val nil set))
  155.   (if set (setf (slot-value 'black-on-white) val))
  156.   (slot-value 'black-on-white))
  157.   
  158. (defmeth graph-proto :center (&rest args)
  159. "Method args: (var &optional shift &key (draw t))
  160. Sets or retrieves current center for variable VAR. Sends :RESIZE and :REDRAW
  161. messages if DRAW is true. Vectorized."
  162.   (apply #'send self :shift args))
  163.  
  164. ; dummy message to allow depth cuing to be turned off when symbols
  165. ; are changed
  166. (defmeth graph-proto :depth-cuing (&optional (on nil set)) nil)
  167.  
  168. (defmeth graph-proto :set-selection-symbol ()
  169. "Method args: ()
  170. Open dialog to set symbol used to plot selected points."
  171.   (let* ((symbols (remove-if #'(lambda (x) (member x '(dot1 dot2 dot3 dot4))) 
  172.                              *plot-symbols*))
  173.          (i (choose-item-dialog "Symbol for selected points" 
  174.                                 (mapcar #'string symbols))))
  175.     (when i
  176.           (let ((plots (adjoin self (linked-plots)))
  177.                 (selection (send self :selection))
  178.                 (symbol (nth i symbols)))
  179.             (dolist (p plots)
  180.                     (if (send p :depth-cuing) (send p :depth-cuing nil))
  181.                     (send p :point-symbol selection symbol)
  182.                     (send p :redraw))))))
  183.  
  184. (defmeth graph-proto :set-selection-color ()
  185. "Method args: ()
  186. Open dialog to set color used to plot selected points."
  187.   (let ((c (choose-item-dialog "Color for selected points" 
  188.                                   (cons "None" (mapcar #'string *colors*)))))
  189.     (when c
  190.           (setf c (if (= c 0) nil (nth (- c 1) *colors*)))
  191.           (let ((plots (adjoin self (linked-plots)))
  192.                 (selection (send self :selection)))
  193.             (dolist (p plots)
  194.                     (if c (send p :use-color t))
  195.                     (send p :point-color selection c)
  196.                     (send p :redraw))))))
  197.  
  198. (defmeth graph-proto :show-all-points ()
  199.   (send self :point-showing (iseq 0 (- (send self :num-points) 1)) t)
  200.   (send self :adjust-to-data))
  201.  
  202. (defmeth graph-proto :selection-dialog ()
  203. "Method args: ()
  204. Open dialog to save or set selection."
  205.   (if (send self :any-points-selected-p)
  206.       (let ((s (get-string-dialog "Name for the selection:")))
  207.         (when s
  208.               (setq s (intern (string-upcase s)))
  209.               (set s (send self :selection))
  210.               (pushnew s *variables*)))
  211.       (let ((s (get-value-dialog "Expression for indices to select:")))
  212.         (if s (send self :point-selected (car s) t)))))
  213.               
  214. ;;; :DRAG-POINT - if there is a point close to the mouse drag it
  215. ;;; and return its index. Otherwise returns NIL.
  216. ;;; For transformed data result only makes sense if transform is
  217. ;;; orthogonal.
  218. ;;;
  219. (defmeth graph-proto :drag-point (x y &key (draw t))
  220.   (let* ((cont-vars (send self :content-variables))
  221.          (cont-x (nth 0 cont-vars))
  222.          (cont-y (nth 1 cont-vars))
  223.          (tol 5)
  224.          (width (* 2 tol))
  225.          (points (send self :points-in-rect
  226.                        (- x tol) (- y tol) width width))
  227.          (p (if points (car points)))
  228.          (transform (send self :transformation)))
  229.     (if (null transform)
  230.         (if p
  231.             (let* ((coords (send self :drag-grey-rect x y tol tol))
  232.                    (sx (+ (nth 0 coords) tol))
  233.                    (sy (+ (nth 1 coords) tol))
  234.                    (rcoords (send self :canvas-to-real sx sy)))
  235.               (send self :point-coordinate cont-x p (nth 0 rcoords))
  236.               (send self :point-coordinate cont-y p (nth 1 rcoords))
  237.               (if draw (send self :redraw))
  238.               p))
  239.         (if p
  240.             (let* ((coords (send self :drag-grey-rect x y tol tol))
  241.                    (sx (+ (nth 0 coords) tol))
  242.                    (sy (+ (nth 1 coords) tol))
  243.                    (sc-coords (send self :canvas-to-scaled sx sy))
  244.                    (sc-x (first sc-coords))
  245.                    (sc-y (second sc-coords))
  246.                    (old-sc-x (send self :point-transformed-coordinate 
  247.                                    cont-x p))
  248.                    (old-sc-y (send self :point-transformed-coordinate
  249.                                    cont-y p))
  250.                    (dims (iseq 0 (- (send self :num-variables) 1)))
  251.                    (reals (send self :point-coordinate dims p))
  252.                    (scale (send self :scale dims))
  253.                    (x-col (compound-data-seq
  254.                            (select transform cont-x dims)))
  255.                    (y-col (compound-data-seq
  256.                            (select transform cont-y dims))))
  257.               (send self :point-coordinate dims p
  258.                     (+ reals (* (+ (* x-col (- sc-x old-sc-x))
  259.                                    (* y-col (- sc-y old-sc-y)))
  260.                                 scale)))
  261.               (if draw (send self :redraw))
  262.               p)))))          
  263.           
  264.  
  265. ;;; :SAVE-IMAGE - saves a postscript image to a file.
  266. #+unix
  267. (defmeth graph-window-proto :save-image (&optional (file "image.ps") &key (scale 1))
  268. "Method args: (&optional (file \"image.ps\"))
  269. Saves a postscript image of the window to file named FILE by buffering,
  270. sending the window the :REDRAW message, and dumping the buffer to a file."
  271.   (let ((file (open file :direction :output)))
  272.     (unwind-protect (send self :image-to-file file scale)
  273.       (close file))))
  274.  
  275. #+unix
  276. (defmeth graph-window-proto :ask-save-image (&optional (file "image.ps"))
  277.   (let ((file (get-string-dialog "Enter a file name for postscript output"
  278.                                  :initial file)))
  279.     (when file
  280.         (if (= (length file) 0) (error "null file name string"))
  281.         (format t "; saving postscript image to file ~a..." file)
  282.         (force-output)
  283.         (send self :save-image file)
  284.         (format t "done~%"))))
  285.  
  286. ;;;;
  287. ;;;;
  288. ;;;; Graph Object Menu and Dialog Methods
  289. ;;;;
  290. ;;;;
  291.  
  292. (send graph-proto :menu-title "Plot")
  293.  
  294. (defmeth graph-proto :menu-template (&optional (val nil set))
  295.   (if set (setf (slot-value 'menu-template) val))
  296.   (slot-value 'menu-template))
  297.  
  298. (send graph-proto :menu-template '(link showing-labels mouse resize-brush dash 
  299.                                         erase-selection focus-on-selection
  300.                                         show-all symbol
  301. #+color                                 color
  302.                                         selection dash 
  303. #-small-machine                         slicer 
  304.                                         rescale 
  305. #-small-machine                         options
  306. #+unix                                  save-image))
  307.          
  308. (defmeth graph-proto :make-menu-item (item-template)
  309.   (if (kind-of-p item-template menu-item-proto)
  310.       item-template
  311.       (case item-template
  312.         (dash (send dash-item-proto :new))
  313.         (link (send link-item-proto :new self))
  314.         (erase-selection
  315.          (send graph-item-proto :new "Remove Selection" self 
  316.                :erase-selection :any-points-selected-p))
  317.         (focus-on-selection
  318.          (send graph-item-proto :new "Focus on Selection" self 
  319.                :focus-on-selection :any-points-selected-p))
  320.         (showing-labels 
  321.          (send graph-item-proto :new "Show Labels" self
  322.                :showing-labels :showing-labels :toggle t))
  323.         (show-all
  324.          (send graph-item-proto :new "Show All" self 
  325.                :show-all-points :all-points-showing-p :negate t))
  326.         (selection
  327.          (send graph-item-proto :new "Selection ..." self 
  328.                :selection-dialog))
  329.         (mouse (send mouse-mode-item-proto :new self))
  330.         (resize-brush 
  331.          (send graph-item-proto :new "Resize Brush" self :resize-brush))
  332.         (redraw 
  333.          (send graph-item-proto :new "Redraw Plot" self :redraw))
  334.         (rescale 
  335.          (send graph-item-proto :new "Rescale Plot" self :adjust-to-data))
  336.         (options 
  337.          (send graph-item-proto :new "Options ..." self :set-options))
  338.         (slicer 
  339.          (send graph-item-proto :new "Slicer ..." self :make-slicer-dialog))
  340.         (symbol
  341.          (send graph-item-proto :new "Selection Symbol" self
  342.                :set-selection-symbol :any-points-selected-p))
  343.         (color
  344.          (send graph-item-proto :new "Selection Color" self
  345.                :set-selection-color :any-points-selected-p))
  346.         (save-image
  347.          (send graph-item-proto :new "Save to File" self :ask-save-image)))))
  348.  
  349. (defmeth graph-proto :new-menu (&optional title &key (items (send self :menu-template)))
  350.   (unless title (setq title (slot-value 'menu-title)))
  351.   (if (slot-value 'menu) (send (slot-value 'menu) :dispose))
  352.   (flet ((make-item (item) (send self :make-menu-item item)))
  353.     (let ((menu (send menu-proto :new title)))
  354.       (send self :menu menu)
  355.       (apply #'send menu :append-items  (remove nil (mapcar #'make-item items)))
  356.       menu)))
  357.     
  358. (defmeth graph-window-proto :clobber ()
  359.   (call-next-method)
  360.   (if (slot-value 'menu) (send (slot-value 'menu) :dispose)))
  361.  
  362. (defmeth graph-window-proto :close () (send self :remove))
  363.  
  364. (defmeth graph-proto :remove ()
  365.   (send self :linked nil)
  366.   (call-next-method))
  367.  
  368. (defmeth graph-proto :add-dialog (d) (send self :add-subordinate d))
  369. (defmeth graph-proto :remove-dialog (d) (send self :delete-subordinate d))
  370.  
  371. (defmeth graph-proto :clear (&rest args)
  372. "Message args: (&key (draw t))
  373. Clears the plot data. If DRAW is nil the plot is redrawn; otherwise its
  374. current screen image remains unchanged."
  375.   (let ((draw (null args)))       ;;;temporary cheat to allow optional or key arg
  376.     (send self :clear-points :draw nil)
  377.     (send self :clear-lines :draw draw)))
  378.  
  379. (defmeth graph-proto :focus-on-selection ()
  380. "Message args: ()
  381. removes all unselected points invisible"
  382.   (let ((i (iseq 0 (- (send self :num-points) 1))))
  383.     (send self :point-showing (set-difference i (send self :selection)) nil)))
  384.  
  385. ;;
  386. ;; Graph Menu Item Prototypes
  387. ;;
  388.  
  389. ;; GRAPH-ITEM-PROTO
  390. (defproto graph-item-proto 
  391.           '(graph update-message toggle negate redraw) () menu-item-proto)
  392.  
  393. (defmeth graph-item-proto :isnew (title graph message 
  394.            &optional update-message &key toggle negate redraw)
  395.   (setf (slot-value 'graph) graph)
  396.   (setf (slot-value 'action) message)
  397.   (setf (slot-value 'update-message) update-message)
  398.   (setf (slot-value 'toggle) toggle)
  399.   (setf (slot-value 'negate) negate)
  400.   (setf (slot-value 'redraw) redraw)
  401.   (call-next-method title))
  402.   
  403. (defmeth graph-item-proto :do-action ()
  404.   (let ((graph (slot-value 'graph))
  405.         (action (send self :action)))
  406.     (if (and action (symbolp action)) 
  407.         (if (slot-value 'toggle) 
  408.             (send graph action (not (send self :update-message)))
  409.             (send graph action))
  410.         (if action (funcall action graph)))
  411.     (if (slot-value 'redraw) (send graph :redraw))))
  412.  
  413. (defmeth graph-item-proto :update-message ()
  414.   (let ((graph (slot-value 'graph)))
  415.     (if (slot-value 'update-message)
  416.         (if (symbolp (slot-value 'update-message))
  417.             (send graph (slot-value 'update-message))
  418.             (funcall (slot-value 'update-message) graph)))))
  419.  
  420. (defmeth graph-item-proto :update () 
  421.   (if (slot-value 'update-message)
  422.     (let ((test (if (send self :update-message) t nil)))
  423.       (send self 
  424.            (if (slot-value 'toggle) :mark :enabled) 
  425.            (if (slot-value 'negate) (not test) test)))))
  426.  
  427. ;; LINK-ITEM-PROTO. Toggles linking and menu text 
  428. (defproto link-item-proto '(graph) () menu-item-proto)
  429.  
  430. (defmeth link-item-proto :isnew (v)
  431.   (setf (slot-value 'graph) v)
  432.   (call-next-method "Link View"))
  433.   
  434. (defmeth link-item-proto :do-action ()
  435.   (send (slot-value 'graph) 
  436.         :linked (not (send (slot-value 'graph) :linked))))
  437.   
  438. (defmeth link-item-proto :update () 
  439.   (send self :title 
  440.         (if (send (slot-value 'graph) :linked) 
  441.             "Unlink View"
  442.             "Link View")))
  443.  
  444. ;; MOUSE-MODE-ITEM-PROTO. Rotates among selecting, brushing, user modes
  445.  
  446. (defproto mouse-mode-item-proto '(graph) () menu-item-proto
  447.   "Menu item for changing the mouse mode")
  448.  
  449. (defmeth mouse-mode-item-proto :isnew (v)
  450.   (setf (slot-value 'graph) v)
  451.   (call-next-method "Mouse Mode ..."))
  452.  
  453. (defmeth mouse-mode-item-proto :do-action ()
  454.   (let ((graph (slot-value 'graph)))
  455.     (send graph :choose-mouse-mode)))
  456.  
  457. ;;;
  458. ;;; Graph mode methods
  459. ;;;
  460.  
  461. (defmeth graph-proto :add-mouse-mode (mode &key 
  462.                                            (title (string mode))
  463.                                            (cursor 'arrow)
  464.                                            click
  465.                        motion)
  466. "Method args: (mode &key (title (string mode)) (cursor 'arrow) click motion)
  467. Adds MODE to the mode list. TITLE is the string used in the menu, CLICK
  468. and MOTION are the selectors for the mouse actions."
  469.   (let ((mode-list (remove mode (slot-value 'mode-list)
  470.                            :test #'(lambda (x y) 
  471.                                      (and (consp y) (eql x (car y)))))))
  472.     (send self :add-slot 'mode-list
  473.           (cons (list mode title cursor click motion) mode-list)))
  474.    mode)
  475.  
  476. (defmeth graph-proto :delete-mouse-mode (mode)
  477. "Method args: (mode)
  478. Deletes MODE to the mode list."
  479.   (let* ((mode-list (slot-value 'mode-list))
  480.          (new-list (remove mode mode-list
  481.                            :test #'(lambda (x y) 
  482.                                      (and (consp y) (eql x (car y)))))))
  483.     (unless (equal mode-list new-list)
  484.             (if (null new-list) (error "Need at least one mouse mode"))
  485.             (send self :add-slot 'mode-list new-list)
  486.             (if (eq mode (send self :mouse-mode))
  487.                 (send self :mouse-mode (first (send self :mouse-modes))))
  488.             mode)))
  489.  
  490. (defmeth graph-proto :set-mode-cursor ()
  491. "Method args: ()
  492. Installs appropriate cursor for current mode."
  493.   (let* ((mode-info (assoc (slot-value 'mouse-mode) (slot-value 'mode-list)))
  494.          (cursor (if mode-info (nth 2 mode-info) 'arrow)))
  495.     (send self :cursor cursor)))
  496.     
  497. (send graph-proto :add-mouse-mode 'selecting 
  498.       :title "Selecting Mode" :click :do-select-click)
  499. (send graph-proto :add-mouse-mode 'brushing 
  500.       :title "Brushing Mode" :cursor 'brush 
  501.       :click :do-brush-click :motion :do-brush-motion)
  502.  
  503. (defmeth graph-proto :mouse-mode-title (mode)
  504. "Method args: (mode)
  505. Returns title for menu item for mouse mode MODE."
  506.   (let ((mode-info (assoc mode (slot-value 'mode-list))))
  507.     (if mode-info (nth 1 mode-info))))
  508.  
  509. (defmeth graph-proto :mouse-modes ()
  510. "Method args: ()
  511. Returns a list of the current mouse modes."
  512.   (reverse (mapcar #'car (slot-value 'mode-list))))
  513.  
  514. (defmeth graph-proto :choose-mouse-mode ()
  515. "Method args: ()
  516. Presents a dialog to set the mouse mode."
  517.   (let* ((modes (send self :mouse-modes))
  518.          (m (choose-item-dialog "New Mode:"
  519.                                 (mapcar #'(lambda (x) 
  520.                                             (send self :mouse-mode-title x))
  521.                                         modes)
  522.                                 :initial (position (send self :mouse-mode)
  523.                                                    modes))))
  524.     (if m (send self :mouse-mode (nth m modes)))))
  525.  
  526. ;;;
  527. ;;; Overlay Methods
  528. ;;;
  529.  
  530. (defmeth graph-proto :redraw-overlays ()
  531.   (dolist (ov (reverse (slot-value 'overlays)))
  532.           (send ov :redraw)))
  533.   
  534. (defmeth graph-proto :resize-overlays ()
  535.   (dolist (ov (slot-value 'overlays))
  536.           (send ov :resize)))
  537.   
  538. (defmeth graph-proto :overlay-click (x y m1 m2)
  539.   (dolist (ov (slot-value 'overlays))
  540.     (if (send ov :do-click x y m1 m2) (return t))))
  541.  
  542. (defmeth graph-proto :add-overlay (ov)
  543.   (if (send ov :graph) (error "Already installed in a graph"))
  544.   (send ov :slot-value 'graph self)
  545.   (setf (slot-value 'overlays) (cons ov (slot-value 'overlays))))
  546.  
  547. (defmeth graph-proto :delete-overlay (ov)
  548.   (when (member ov (slot-value 'overlays))
  549.         (send ov :slot-value 'graph nil)
  550.         (setf (slot-value 'overlays) (remove ov (slot-value 'overlays)))))
  551.  
  552. (defproto graph-overlay-proto '(graph))
  553.  
  554. (defmeth graph-overlay-proto :graph () (slot-value 'graph))
  555. (defmeth graph-overlay-proto :resize () nil)
  556. (defmeth graph-overlay-proto :redraw () nil)
  557. (defmeth graph-overlay-proto :do-click (x y m1 m2) nil)
  558.  
  559. (require "graphics2" #+msdos "graph2")
  560.